package middlecontent.loader;

/**
 * @Author: fxy
 * @Date: 2023/01/04/13:13
 * @Description:
 */
public class DeadLock {
    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
            A a = new A();
        });

        Thread t2 = new Thread(()->{
            B b = new B();
        });

        t1.start();
        t2.start();
    }
}

class A{
    static {
        try {
            Thread.sleep(100);
            System.out.println("等待加载B");
            Class<?> aClass = Class.forName("middlecontent.loader.B");
        } catch (ClassNotFoundException | InterruptedException e) {
            e.printStackTrace();
        }
    }
}

class B{
    static {
        try {
            Thread.sleep(100);
            System.out.println("等待加载A");
            Class<?> aClass = Class.forName("middlecontent.loader.A");
        } catch (ClassNotFoundException | InterruptedException e) {
            e.printStackTrace();
        }
    }
}
